Skip to content

windows: implement st_birthtime restoration, fixes #8730#9341

Open
trxvorr wants to merge 1 commit intoborgbackup:masterfrom
trxvorr:fix-8730-win-birthtime
Open

windows: implement st_birthtime restoration, fixes #8730#9341
trxvorr wants to merge 1 commit intoborgbackup:masterfrom
trxvorr:fix-8730-win-birthtime

Conversation

@trxvorr
Copy link
Contributor

@trxvorr trxvorr commented Feb 15, 2026

This PR implements the restoration of file creation time (st_birthtime) on Windows, addressing Issue #8730.

Changes

  • Platform Support: Added set_birthtime in src/borg/platform/init.py using ctypes and SetFileTime to precisely set creation time on NTFS.
  • Archiver: Updated Archive.restore_attrs to call set_birthtime on Windows when birthtime metadata is present.
  • Tests:
    • Added unit (win32_birthtime_test.py) and E2E (win32_birthtime_e2e_test.py) tests verifying birthtime preservation.
    • Updated is_birthtime_fully_supported and fixed test_nobirthtime to validly test birthtime behavior on Windows (handling st_birthtime != st_mtime semantics).

Verification

  • Verified on Windows with Python 3.12+.
  • New unit and E2E tests pass.
  • Existing test_nobirthtime now passes locally on Windows.

@trxvorr trxvorr force-pushed the fix-8730-win-birthtime branch from d6dbc75 to 2f50ad0 Compare February 15, 2026 15:50
@codecov
Copy link

codecov bot commented Feb 15, 2026

Codecov Report

❌ Patch coverage is 33.33333% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.48%. Comparing base (2357071) to head (b54336a).
⚠️ Report is 8 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/borg/platform/__init__.py 20.00% 4 Missing ⚠️
src/borg/archive.py 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9341      +/-   ##
==========================================
- Coverage   76.50%   76.48%   -0.03%     
==========================================
  Files          85       85              
  Lines       14818    14826       +8     
  Branches     2214     2215       +1     
==========================================
+ Hits        11337    11339       +2     
- Misses       2803     2809       +6     
  Partials      678      678              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@trxvorr trxvorr force-pushed the fix-8730-win-birthtime branch 6 times, most recently from 9b57619 to a1face0 Compare February 15, 2026 19:59
@trxvorr trxvorr force-pushed the fix-8730-win-birthtime branch 4 times, most recently from 55000f7 to 91be6ae Compare February 15, 2026 20:58
@trxvorr trxvorr marked this pull request as draft February 22, 2026 13:13
@ThomasWaldmann
Copy link
Member

Please update your local master branch and then rebase this branch onto that master and force push.

That should solve the CI test failures that are unrelated to your work.

@trxvorr trxvorr marked this pull request as ready for review February 25, 2026 15:32
@trxvorr trxvorr marked this pull request as draft February 25, 2026 15:33
@trxvorr trxvorr force-pushed the fix-8730-win-birthtime branch 3 times, most recently from bccac20 to ac834f1 Compare February 25, 2026 15:40
@trxvorr trxvorr force-pushed the fix-8730-win-birthtime branch 7 times, most recently from 9dac1c1 to 92d9236 Compare March 1, 2026 07:44
@trxvorr trxvorr marked this pull request as ready for review March 1, 2026 10:57
@trxvorr trxvorr requested a review from ThomasWaldmann March 1, 2026 10:57
@trxvorr trxvorr force-pushed the fix-8730-win-birthtime branch 2 times, most recently from af89193 to b54336a Compare March 1, 2026 11:07
Copy link
Member

@ThomasWaldmann ThomasWaldmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some feedback

@trxvorr trxvorr force-pushed the fix-8730-win-birthtime branch from b54336a to 8afc7c6 Compare March 1, 2026 16:00
@trxvorr trxvorr force-pushed the fix-8730-win-birthtime branch from 8afc7c6 to a58aa8d Compare March 1, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants